<section id="democratic_quality_stats" class="home__section home__section-content-block">
  <h2 class="home__section-title">
    <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.name") %>
  </h2>

  <div>
    <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
      <%= cell "decidim/participatory_processes/indicator", nil, metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.global_score.name"), metric_value: stats[:global_score], metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.global_score.tooltip") %>
      <div class="text-md col-span-3 text-gray-2 prose-a:underline">
        <p><%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.global_score.description_html", info_url:) %></p>
        <p class="text-sm mt-4 text-gray">
          <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.global_score.note") %>
        </p>
      </div>
    </div>
    <div class="mt-8">
      <h4 class="uppercase text-md font-semibold tracking-wider text-gray-2">
        <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.name") %>
      </h4>
      <p class="text-md mt-2 text-gray-2">
        <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.description") %>
      </p>
      <div class="grid grid-cols-1 md:grid-cols-4 gap-4 mt-4">
        <%= cell "decidim/participatory_processes/indicator",
                 nil,
                 metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.influence"),
                 metric_value: stats[:automatic][:influence],
                 metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.influence_tooltip") %>
        <%= cell "decidim/participatory_processes/indicator",
                 nil,
                 metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.hybridization"),
                 metric_value: stats[:automatic][:hybridization],
                 metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.hybridization_tooltip") %>
        <%= cell "decidim/participatory_processes/indicator",
                 nil,
                 metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.transparency"),
                 metric_value: stats[:automatic][:transparency],
                 metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.transparency_tooltip") %>
        <%= cell "decidim/participatory_processes/indicator",
                 nil,
                 metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.traceability"),
                 metric_value: stats[:automatic][:traceability],
                 metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.automatic_metrics.indicators.traceability_tooltip") %>
      </div>
    </div>
    <% if finished_survey? %>
      <div class="mt-8">
        <h4 class="uppercase text-md font-semibold tracking-wider text-gray-2">
          <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.name") %>
        </h4>
        <p class="text-md mt-2 text-gray-2">
          <%= t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.description") %>
        </p>
        <div class="grid grid-cols-1 md:grid-cols-4 gap-4 mt-4">
          <%= cell "decidim/participatory_processes/indicator",
                   nil,
                   metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.inclusiveness"),
                   metric_value: stats[:auto_evaluation][:inclusiveness],
                   metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.inclusiveness_tooltip") %>
          <%= cell "decidim/participatory_processes/indicator",
                   nil,
                   metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.citizen_influence"),
                   metric_value: stats[:auto_evaluation][:citizen_influence],
                   metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.citizen_influence_tooltip") %>
          <%= cell "decidim/participatory_processes/indicator",
                   nil,
                   metric_name: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.informativeness"),
                   metric_value: stats[:auto_evaluation][:informativeness],
                   metric_tooltip: t("decidim.participatory_processes.content_blocks.democratic_quality_stats.qualitative_metrics.indicators.informativeness_tooltip") %>
        </div>
      </div>
    <% end %>
  </div>
</section>
